<?php

namespace common\validate;


class ProjectTeam extends BaseValidate
{
    // 验证规则
    protected $rule = [];


    // 验证场景定义
    public function sceneSaveConfig()
    {
        return $this->append('data.name', 'require|max:128')
            ->append('data.type', 'integer|between:1,2')
            ->append('data.unit', 'integer|between:1,3')
            ->append('data.role_id', 'require')
            ->append('data.order', 'integer')
            ->append('data.step_category_id', 'require');
    }

    public function sceneConfigList()
    {
        return $this->append('param.project_id', 'integer')
            ->append('param.project_template_id', 'integer');
    }

    public function sceneDelConfig()
    {
        return $this->append('param.filter.ids', 'require');
    }

    public function sceneTemplateTeamConfig()
    {
        return $this->append('param.id', 'require|integer')
            ->append('param.template_id', 'require|integer')
            ->append('param.type', 'integer|between:1,2');
    }

    public function sceneTeamAddUser()
    {
        return $this->append('param.project_id', 'require|integer')
            ->append('param.team_id', 'require|integer')
            ->append('param.old_team_id', 'integer')
            ->append('param.user_id', 'require|max:512');
    }

    public function sceneTeamDelUser()
    {
        return $this->append('param.project_id', 'require|integer')
            ->append('param.team_id', 'require|integer')
            ->append('param.user_id', 'require|max:512');
    }

    public function sceneTeamSaveUserRole()
    {
        return $this->append('param.project_id', 'require|integer')
            ->append('param.team_id', 'require|integer')
            ->append('param.role_id', 'require|integer')
            ->append('param.user_id', 'require|integer')
            ->append('param.type', 'integer|between:1,2');
    }

    public function sceneTeamUserList()
    {
        return $this->append('param.project_id', 'require|integer')
            ->append('param.step_category_id', 'integer')
            ->append('param.team_id', 'integer');
    }

    public function sceneGetUserTeamList()
    {
        return $this->append('param.project_id', 'require|integer')
            ->append('param.user_id', 'require|integer');
    }

    // 项目团队成员列表验证
    public function sceneProjectUserList()
    {
        return $this->append('param.project_id', 'require|integer');
    }

}
